package com.bwie.task;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bwie.mapper.ProdAttaMapper;
import com.bwie.mapper.ProdMapper;
import com.bwie.pojo.Prod;
import com.bwie.pojo.ProdAtta;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * @Author: tsh
 * @Date: 2025/7/22 20:11
 * @Description: TODO
 **/
@Component
@Slf4j
public class ProdDownTask {

    @Autowired
    ProdMapper ProdMapper;

    /**
     * 每分钟检查一次商品上架
     */
    @Scheduled(cron = "0 0/1 * * * ?")
    public void uploadProdTask() {
        System.out.println("开始执行定时上架任务");
        ProdMapper.taskUploadProd();
        System.out.println("执行成功定时上架任务");
    }

    /**
     * 每分钟检查一次商品下架
     */
    @Scheduled(cron = "0 0/1 * * * ?")
    public void taskOfflineProd() {
        System.out.println("开始执行定时下架任务");
        ProdMapper.taskOfflineProd();

        System.out.println("执行结束定时下架任务");
    }
}
